home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / sysolm.lha / SysOLM.rexx < prev    next >
OS/2 REXX Batch file  |  1993-12-12  |  10KB  |  312 lines

  1.  
  2. /*
  3.  
  4. Automatically sends your callers certain OLMs during certain events.
  5. The SysOp can add/remove OLMs, configure when they occur, and what they say.
  6.  
  7. > *** System Message ***
  8. > New file just uploaded.  Type "NF" to list.
  9.  
  10. > *** System Message ***
  11. > Users have started a group-conference.  To join, type "J" from the main-menu.
  12.  
  13. > *** System Message ***
  14. > New vote-topic added.  Type "VOTE" from the main-menu.
  15.  
  16. > *** System Message ***
  17. > New caller just logged-in.  Type "WHO" to list.
  18.  
  19. > *** System Message ***
  20. > Caller just logged-out.  Type "WHO" to list.
  21.  
  22. > *** System Message ***
  23. > New-user just registered.
  24.  
  25. > *** System Message ***
  26. > Network mail has arrived and is being unpacked.
  27. > (System slow-down may occur.)
  28.  
  29.  
  30.  
  31. Each user can configure which System-OLMs he wishes to receive/avoid:
  32.  
  33. > [A] <OFF> Also ring bell during these System-OLMs?
  34. > [B] <ON>  New file just uploaded.  Type 'NF' to list.
  35. > [C] <ON>  New message just posted.  Type 'NM' to list.
  36. > [D] <ON>  New response just posted.  Type 'NM' to list.
  37. > [E] <ON>  New vote-topic being added.  Type 'VOTE' from the main-menu.
  38. > [F] <OFF> New news/gfile/pfile added.
  39. > [G] <ON>  New caller just logged-in.  Type 'WHO' to list.
  40. > [H] <ON>  Caller just logged-out.  Type 'WHO' to list.
  41. > [I] <ON>  New-user starting the registration process.
  42. > [J] <ON>  New-user just completed the registration process.
  43. > [K] <ON>  Network mail is being processed.
  44. > [L] <OFF> Network mail is done being processed.
  45. > [M] <OFF> SysOp is now available for chats.
  46. > [N] <ON>  SysOp is no longer available for chats.
  47. > [O] <ON>  The system currently has ALL lines in use.
  48. > [P] <ON>  Polling for network mail.
  49. > [Q] <OFF> Users have started a group-conference.
  50. >
  51. > Toggle which on/off (_BCDE_GHIJK__NOP_) [none]:
  52.  
  53. $VER: SysOLM.rexx v1.0 Sat 11-Dec-93 07:58:06
  54.    Written/tested with CNet v2.94beta
  55.  
  56. Installation:
  57.    1) Copy SysOLM.rexx  TO  pfiles:SysOLM.rexx
  58.  
  59.    2) Add the following lines onto the END of the CNet:BBSmenu list
  60.       marked as "2; Available everywhere":
  61.          CFGOlm  | {#4 rx Pfiles:SysOLM.rexx - %23}
  62.  
  63.    3) Add the following lines onto the END of the CNet:BBSmenu list
  64.       marked as "1; Maintenance commands":
  65.          SYSOlm  | {#4 rx Pfiles:SysOLM.rexx ? %23}
  66.  
  67.    4) Edit the lines below marked "SysOp-settable variables".
  68.  
  69.    5) Editing CNet:BBStext...
  70.  
  71. Now comes the hard part.  You have to find, and change, the correct
  72. lines within CNet:BBStext.  Without any kind of documenation for BBStext,
  73. I've only managed to find a few.  If you find others, please post them.
  74. In each of the following cases, change the 1st line into the 2nd line.
  75.  
  76. Post filed...
  77. 401> h6ed.n1
  78. 401> h6ed. #4 rx Pfiles:SysOLM.rexx C %23} n1
  79.  
  80. Response filed...
  81. 479> h6ed.n1
  82. 479> h6ed. {#4 rx Pfiles:SysOLM.rexx D %23} n1
  83.  
  84. New vote-topic being added...
  85. 1559> 100 float vote item    [No]: ?0
  86. 1559> 100 float vote item    [No]: ?0 {#4 rx Pfiles:SysOLM.rexx E %23}
  87.  
  88. New-user starting to register...
  89. Add "{#4 rx Pfiles:SysOLM.rexx I %23}" into your "SysText:new/nu0" file.
  90.  
  91. I have an AmigaDOS-script that I run to process network mail.
  92. In addition to calling the CNetTosser, I also added:
  93. DOS> rx Pfiles:SysOLM.rexx K        ; Send notice #K, "Start of process"
  94. DOS> ...                            ; Call the tosser, whatever...
  95. DOS> rx Pfiles:SysOLM.rexx L        ; Send notice #L, "End of process"
  96.  
  97. ------------------ End of installation info --------------------------------
  98.  
  99. SysOLM.rexx can be run online, or from the CLI.
  100. If run online, it needs to know the user's port #.  (Always use %23)
  101.  
  102. BBSTEXT {#4 rx Pfiles:SysOLM.rexx D %23}   (Send string D during this event.)
  103. BBSMENU {#4 rx Pfiles:SysOLM.rexx - %23}   (Let user configure their set-up.)
  104. BBSMENU {#4 rx Pfiles:SysOLM.rexx ? %23}   (Let user pick 1 string to send.)
  105. CLI         rx Pfiles:SysOLM.rexx C        (Send everyone string C.)
  106. CLI         rx Pfiles:SysOLM.rexx          (Show menu of choices, pick, send.)
  107. CLI         rx Pfiles:SysOLM.rexx W        ("W" isn't configured.  Show menu.)
  108.  
  109. If you make many changes to your OLM-strings AFTER users have
  110. configured their OLMs with CfgOLM, you many wish to force everyone to
  111. re-configure their set-up.
  112. Just execute the following cmd from the DOS prompt:
  113.    CLI> Delete Mail:Users/#?/SysOLM.cfg
  114. Everyone's config-file will be deleted.
  115.  
  116. You can file-requ the latest release of this file under the MagicName
  117. "SysOLM" from 1:2410/207 24hrs/day @14.4K.
  118.  
  119. SysOLM.rexx by
  120.    Bill Beogelein
  121.    Box 530441
  122.    Livonia, MI 48153
  123.    BBS 810-473-2020, Fido 1:2410/207
  124.  
  125. Ignore:
  126.    lz u CNet3:SysOLM.LHA CNet:rexx/SysOLM.rexx a:zzzBBSad Help:BB_CMDS
  127.    Copy CNet3:SysOLM.LHA UP:
  128.  
  129. Future ideas, or known bugs:
  130.    When SysOp uses this prg from the CLI, if user is sitting at
  131.    "More[Y,n,c]" prompt, this script can't continue until he hits
  132.    [RETURN].
  133.  
  134.    Can't address CNETREXX0; 'sendString' "Any \n MCI codes..."
  135.  
  136.    Have the online cmd prompt reappear after the OLM is displayed.
  137.    (Like CNet's own system-messages.)       But how?
  138.  
  139. */
  140.  
  141. /***************** Top of SysOp-settable variables ***************************/
  142. header = "*** System-Message ***"   /* "Header" is displayed BEFORE all msgs. */
  143.  
  144. olm.A  = "Also ring bell during these System-OLMs?"      /* BELL must be #A */
  145. olm.B  = "New file just uploaded.  Type 'NF' to list."
  146. olm.C  = "New message just posted.  Type 'NM' to list."
  147. olm.D  = "New response just posted.  Type 'NM' to list."
  148. olm.E  = "New vote-topic being added.  Type 'VOTE' from the main-menu."
  149. olm.F  = "New news/gfile/pfile added."
  150. olm.G  = "New caller just logged-in."          /* Use CNet's "UM" instead */
  151. olm.H  = "Caller just logged-out."             /* Use CNet's "UM" instead */
  152. olm.I  = "New-user starting the registration process."
  153. olm.J  = "New-user just completed the registration process."
  154. olm.K  = "Network mail is being processed.  System slow-down may occur."
  155. olm.L  = "Network mail is done being processed."
  156. olm.M  = "SysOp is now available for chats."
  157. olm.N  = "SysOp is no longer available for chats."
  158. olm.O  = "The system currently has ALL lines in use.  System slow-down may occur."
  159. olm.P  = "Polling for network mail."
  160. olm.Q  = "Users have started a group-conference.  To join, type 'J' from the main-menu."
  161. olm.R  = ""
  162. olm.S  = ""
  163. olm.T  = ""
  164. olm.U  = ""
  165. olm.V  = ""
  166. olm.W  = ""
  167. olm.X  = ""
  168. olm.Y  = ""
  169. olm.Z  = ""
  170.  
  171.                                    /* "Footer" is displayed AFTER all msgs. */
  172. footer = "(Type 'CfgOLM' to suppress these System-Messages.)"
  173.  
  174. minline =  0      /* Lowest  line # that gets System-Messages (0-99) */
  175. maxline = 40      /* Highest line # that gets System-Messages (0-99) */
  176.  
  177. bell = 0    /* Bell rings   (0=REMOTE ONLY;    1=LOCAL+REMOTE screens) */
  178. log  = 1    /* Write activity to log?                   (0=NO;  1=YES) */
  179. /******************** End of SysOp-settable variables ****************************/
  180.  
  181. options results
  182. NO   = (1==0)
  183. YES  = (1==1)
  184. parse arg which port
  185. which = upper(strip(which))
  186. port  =       strip(port)
  187. cli   = NO
  188. if(port="") then
  189. do
  190.    port=999
  191.    cli=YES        /* Running from the CLI */
  192. end
  193.  
  194. portname="CNETREXX" || port
  195.  
  196. LF   = '0a'x
  197.  
  198. if( which='-' ) then    /* Just load/configure/save */
  199. do
  200.    address value portname
  201.    call LoadCfg()
  202.  
  203.    do forever
  204.       'transmit' LF "         SysOLM.rexx by Bill Beogelein" LF
  205.       max=0
  206.       do ii=1 to 26
  207.          ch=d2c(ii+64)
  208.          if(olm.ch=="") then leave
  209.          if( pos(ch, cfg)>0 ) then status="<ON> "; else status="<OFF>"
  210.          'transmit' "[" || ch || "]" status left(olm.ch, 62)
  211.          max=max+1
  212.       end
  213.  
  214.       'sendString' LF || "Toggle which on/off (" || left(cfg, max) || ") [none]: "
  215.       'getChar'; ans=RESULT; 'transmit' ans
  216.       if( ans<'A' | ans>d2c(max+64) ) then leave
  217.       pp=c2d(ans)-64
  218.       if( substr(cfg, pp, 1) = ans ) then
  219.          cfg=overlay('_', cfg, pp, 1)
  220.       else
  221.          cfg=overlay(ans, cfg, pp, 1)
  222.    end
  223.    call SaveCFG()
  224.    exit
  225. end
  226.  
  227. if( olm.which=="" | which=="" | which=="?" ) then   /* Pick 1 and send it */
  228. do
  229.    say LF "         SysOLM.rexx by Bill Beogelein" LF
  230.    do ii=1 to 26
  231.       ch=d2c(ii+64)
  232.       if(olm.ch=="") then leave
  233.       say "[" || ch || "]" left(olm.ch, 74)
  234.    end
  235.    call writeCH(STDOUT, LF || "Send which [none]: ")
  236.    which=upper(readLN(STDIN))
  237.    if(which=="") then exit
  238.    cli=YES                    /* Maybe online, too */
  239. end
  240.  
  241. do ii=minline to maxline
  242.    portname="CNETREXX" || ii
  243.    if( show(PORTS, portname) ) then loaded=YES; else loaded=NO
  244.    if( ii=port )               then myport=YES; else myport=NO
  245.  
  246.    if( loaded & ~myport) then
  247.    do
  248.       address value portname
  249.       call LoadCFG()
  250.  
  251.       if(inuse) then
  252.       do
  253.          if( pos(which, cfg)>0 ) then
  254.          do
  255.             str = "Port" right(ii, 2) ": Receiving   msg" which
  256.             if(cli) then say str
  257.             call ToLog(str)
  258.             'transmit' LF LF || header LF olm.which LF || footer
  259.  
  260.             if( left(cfg, 1)='A' ) then BEEP = '07'x; else BEEP = ""
  261.             if(bell) then 'sendString' BEEP; else 'sendModem' BEEP
  262.          end
  263.          else
  264.          do
  265.             str = "Port" right(ii, 2) ": Suppressing msg" which
  266.             if(cli) then say str
  267.             call ToLog(str)
  268.          end
  269.       end
  270.    end
  271. end
  272. exit        /****** End of main ******/
  273.  
  274. LoadCfg:
  275.    /* address value portname */
  276.  
  277.    cfg="ABCDEFGHIJKLMNOPQRSTUVWXYZ"    /* Default for new acct is "bell ON" */
  278.    'getUser' 39; home = RESULT
  279.    cfgname= "Mail:Users/" || home || "/SysOLM.cfg"
  280.  
  281.    /* 'transmit' cfg home cfgname x which x */
  282.  
  283.    'getCarrier'; if( RESULT="TRUE" ) then inuse=YES; else inuse=NO
  284.    if(inuse) then
  285.    do
  286.       if(open(fp, cfgname, 'READ')) then
  287.       do
  288.          cfg=readLN(fp)
  289.          call close(fp)
  290.       end
  291.    end
  292. return
  293.  
  294. SaveCfg:
  295.    if(open(fp, cfgname, 'WRITE')) then
  296.    do
  297.       call writeLN(fp, cfg)
  298.       'transmit' LF || "Saving your setting (" || left(cfg, max) || ") to" cfgname
  299.       call ToLog("CFG set to" cfg)
  300.       call close(fp)
  301.    end
  302.    else
  303.       'transmit' LF || "*** Can't open" cfgname "for write."
  304. return
  305.  
  306. ToLog:
  307.    parse arg str
  308.    if(log) then 'LogEntry' "SysOLM.rexx :" str
  309. return
  310.  
  311. /*** EOF SysOLM.rexx 810-473-2020 ***/
  312.